package com.example.esc_im_client;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import com.alipay.mobile.cubedebug.crystal.CubeCardDebug;
import com.example.esc_im_client.ui.home.FastActivity;
import com.example.esc_im_client.ui.menu.MenuActivity;
import com.example.esc_im_client.ui.newview.NewViewActivity;
import com.google.android.material.bottomnavigation.BottomNavigationView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import androidx.appcompat.widget.Toolbar;


import com.example.esc_im_client.databinding.ActivityMainBinding;
import com.mpaas.mpaasadapter.api.upgrade.MPUpgrade;
import com.mpaas.nebula.adapter.api.MPNebula;

public class MainActivity extends AppCompatActivity {

    private ActivityMainBinding binding;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);



        binding = ActivityMainBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        Button button = findViewById(R.id.demoButton);
        Button buttondev = findViewById(R.id.demoButton2);
        buttondev.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View view) {
                CubeCardDebug.openScanner(MainActivity.this);
            }
        });

        Button buttondevnew = findViewById(R.id.demoButton3);
        buttondevnew.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(MainActivity.this, FastActivity.class);
                startActivity(intent);

            }
        });

        Button btnH5 = findViewById(R.id.demoButton5);
        btnH5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MPNebula.startUrl("https://www.zwfw.hlj.gov.cn/jmopenpub/jmopen_files/webapp/html5/fwdtipxzd/index.html?areaName=%E9%BD%90%E9%BD%90%E5%93%88%E5%B0%94%E5%B8%82&areaCode=230200000000#/");

            }
        });

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent();
                intent.setClass(MainActivity.this, NewViewActivity.class);
                startActivity(intent);
            }
        });

        Button button1 = findViewById(R.id.demoButton1);
        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent();
                intent.setClass(MainActivity.this, MenuActivity.class);
                startActivity(intent);
            }
        });

        Button update = findViewById(R.id.demoButton4);
        update.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MPUpgrade mMPUpgrade = new MPUpgrade();
                mMPUpgrade.fastCheckNewVersion(MainActivity.this, ContextCompat.getDrawable(MainActivity.this,R.drawable.ic_launcher_background));
            }
        });


        BottomNavigationView navView = findViewById(R.id.nav_view);
        AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
                R.id.navigation_chat, R.id.navigation_friend, R.id.navigation_trends,R.id.navigation_my)
                .build();
        Toolbar customToolbar = findViewById(R.id.custom_toolbar);
        setSupportActionBar(customToolbar);
        Log.d("初始化全部界面","appBarConfiguration");
        NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main);
        NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
        NavigationUI.setupWithNavController(binding.navView, navController);


    }




}